<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	
	
	</head>
	
	<body>
	
	
	<script>
	//一、菱形
	document.write(" <center> ");
	var row=Number(prompt("输入行数"));
	for(var i=1;i<=2*row-1;i++){
	    var stars=2*row-1-2*Math.abs(i-row);//星
	    for(var j=1;j<=stars;j++){
	        document.write(" * ");
	    }
	    document.write("<br>");
	}
	
	//二、1-100累加的和
	function recursion(i){
	  if(i==1)return i;
	  return i+recursion(i-1)
	}
	
	alert(recursion(100))
	
	
	
	</script> 
	
	
	</body>
	
	</html>
